package com.jsgt.greekfire.ui.trading.adapter

import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentManager
import androidx.fragment.app.FragmentPagerAdapter
import com.fhx.core.base.BaseFragment

/**
 * Created by Administrator on 2018/1/30.
 */
class PagerAdapter(
    fm: FragmentManager?,
    private val fragments: List<BaseFragment>,
    private val tables: List<String>?
) : FragmentPagerAdapter(fm!!) {
    override fun getItem(position: Int): Fragment {
        return fragments[position]
    }

    override fun getCount(): Int {
        return fragments.size
    }

    override fun getPageTitle(position: Int): CharSequence? {
        return if (tables == null || tables.isEmpty()) super.getPageTitle(position) else tables[position]
    }

}